<#include "/ftl/admin/common/_layout.html"/>
<@layout page_tab="reply">
<ol class="breadcrumb">
    <li><a href="${baseUrl!}/admin">首页</a></li>
    <li><a href="${baseUrl!}/admin/topic">回复</a></li>
    <li class="active">列表</li>
</ol>
<table class="table table-hover" style="table-layout: fixed;">
    <thead>
    <th width="300">标题</th>
    <th width="100">作者</th>
    <th>内容</th>
    <th width="170">时间</th>
    <th width="50">操作</th>
    </thead>
    <tbody>
    <#list page.getList() as reply>
        <tr id="reply_${reply.id!}">
            <td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">${reply.title!}</td>
            <td>${reply.nickname}</td>
            <td style="white-space: nowrap;text-overflow: ellipsis;overflow: hidden;">
                <a href="/topic/${reply.tid!}.html#${reply.id}" target="_blank">${reply.content!}</a>
            </td>
            <td>${reply.in_time!}</td>
            <td>
                <a href="javascript:deleteReply('${reply.id!}')"><span class="glyphicon glyphicon-trash"></span></a>
            </td>
        </tr>
    </#list>
    </tbody>
</table>
<#include "/ftl/front/common/_paginate.html"/>
<@paginate currentPage=page.pageNumber totalPage=page.totalPage actionUrl="/admin/reply/index" urlParas="" />
</@layout>
<script type="text/javascript">
    function deleteReply(id) {
        if(confirm("确定 删除回复 吗？\n(注：这会删除其他回复引用该回复的内容！)")) {
            $.ajax({
                url : "${baseUrl!}/admin/reply/delete",
                async : false,
                cache : false,
                type : 'post',
                dataType : "json",
                data : {
                    id: id
                },
                success : function(data) {
                    if(data.code == '200') {
                        $("#reply_" + id).remove();
                    } else {
                        alert(data.description);
                    }
                }
            });
        }
    }
</script>
